home *** CD-ROM | disk | FTP | other *** search
- *
- * hook.asm -- Asm example that calls the EL_InstallLIHook function
- *
- * $
- * $ FILE : E_G_S:Wartung&Pflege/A-Include/egs/hook.asm
- * $ VERSION : 1
- * $ REVISION : 78
- * $ DATE : 10-Mar-93 12:40
- * $
- * $ Author : mvk
- * $
- *
- *
- *
- *
- *
- *
- *
- *
-
- INCLUDE "exec/types.i"
- INCLUDE "exec/macros.i"
- INCLUDE "exec/libraries.i"
- INCLUDE "exec/nodes.i"
- INCLUDE "exec/ports.i"
-
- INCLUDE "egs/egs.i"
- INCLUDE "egs/egsblit.i"
- INCLUDE "egs/egslayers.i"
- INCLUDE "egs/egsgfx.i"
- INCLUDE "egs/egsintuigfx.i"
- INCLUDE "egs/egsintui.i"
-
- INCLUDE "egs/lvo/lvo_egs.i"
- INCLUDE "egs/lvo/lvo_egsblit.i"
- INCLUDE "egs/lvo/lvo_egslayers.i"
- INCLUDE "egs/lvo/lvo_egsgfx.i"
- INCLUDE "egs/lvo/lvo_egsintui.i"
-
- XDEF _main
-
- XREF _printf
- XREF _AbsExecBase
-
-
- EXTERN_LIB OpenLibrary
- EXTERN_LIB CloseLibrary
- EXTERN_LIB GetMsg
- EXTERN_LIB WaitPort
- EXTERN_LIB ReplyMsg
-
-
- STRUCTURE my_libs,0
- APTR my_egsblit
- APTR my_egsintui
- APTR my_egslayer
- APTR my_win
- APTR my_layer
- APTR my_msg
- APTR my_port
- LABEL my_SIZE
-
- section code
-
-
- _main:
- ;------ open the test library: this will bring it in from disk
- move.l _AbsExecBase,a6
- lea -my_SIZE(a7),a7 ;Sturcture Memory
- move.l a7,a5
- move.l a7,myptr
-
- lea egsblitName(pc),a1
- moveq #0,d0
- CALLLIB _LVOOpenLibrary
- move.l d0,my_egsblit(a5)
-
- lea egslayerName(pc),a1
- moveq #0,d0
- CALLLIB _LVOOpenLibrary
- move.l d0,my_egslayer(a5)
-
- lea egsintuiName(pc),a1
- moveq #0,d0
- CALLLIB _LVOOpenLibrary
- move.l d0,my_egsintui(a5)
-
- tst.l d0
- bne.s 1$
-
- ;------ couldn't find the library
-
- pea LibsName(pc)
- pea nolibmsg(pc)
- jsr _printf
- addq.l #8,sp
-
- bra main_end
-
- 1$:
-
- pea LibsName(pc)
- pea Msg1(pc)
- jsr _printf
- addq.l #8,sp ;fix 2 long stack pushes
-
- ;------ print the library name, version, and revision
- clr.l d0
-
- pea Msg2(pc)
- jsr _printf
- addq.l #4,sp
-
- ;------ call the first test function
-
- lea mywin,a0
- LINKLIB _LVOEI_OpenWindow,my_egsintui(a5)
-
- tst.l d0
- bne 2$
-
- pea Msg4(pc)
- jsr _printf
- addq.l #4,sp ;fix 1 long stack pushes
-
- bra 3$
-
- 2$:
-
- move.l d0,my_win(a5)
- move.l d0,a0
- move.l eiwi_UserPort(a0),my_port(a5)
-
- move.l eiwi_WLayer(a0),a0
- move.l ella_LayerInfo(a0),my_layer(a5)
-
- move.l my_layer(a5),a0
- lea hook,a1
- LINKLIB _LVOEL_InstallLIHook,my_egslayer(a5)
-
- ;
- ; Message Handeling
- ;
-
- 5$:
- move.l my_port(a5),a0
- CALLLIB _LVOWaitPort
- move.l my_port(a5),a0
- CALLLIB _LVOGetMsg
- move.l d0,my_msg(a5)
- move.l d0,a1
- CALLLIB _LVOReplyMsg
-
- move.l my_msg(a5),a1
- move.l eims_Class(a1),d0
- cmp.l #EI_iCLOSEWINDOW,d0
-
- bne.b 5$
-
- ;
- ; Close
- ;
-
-
- pea Msg5(pc)
- jsr _printf
- addq.l #4,sp ;fix 1 long stack pushes
-
- move.l my_win(a5),a0
- LINKLIB _LVOEI_CloseWindow,my_egsintui(a5)
-
- move.l my_layer(a5),a0 ;Remove Hook
- move.l #0,a1
- LINKLIB _LVOEL_InstallLIHook,my_egslayer(a5)
-
- 3$:
- ;------ close the egs.library
-
- move.l _AbsExecBase,a6
- move.l my_egsblit(a5),a1
- CALLLIB _LVOCloseLibrary
-
- move.l my_egslayer(a5),a1
- CALLLIB _LVOCloseLibrary
-
- ;------ close the egsblit.library
- move.l my_egsintui(a5),a1
- CALLLIB _LVOCloseLibrary
-
- main_end:
- lea my_SIZE(a7),a7
- moveq #0,d0
- rts
-
- STRUCTURE my_apply,0
- LONG map
- LONG data
- LONG x
- LONG y
- LONG w
- LONG h
- LONG ox
- LONG oy
- LONG c
- LABEL my_MEM
-
- ;
- ; Hookroutine for screen
- ;
- ; it makes a colorflow in the background of the screen
- ;
-
- myapply:
- ; in A0 = EBitMap
- ; in A1 = Data
- ; d0 = x
- ; d1 = y
- ; d2 = width
- ; d3 = height
- ; d4 = ox
- ; d5 = oy
-
- movem.l d2-d7/a2-a7,-(sp)
- lea -my_MEM(a7),a7 ; get memory
- move.l myptr,a5 ; get pointer for
- ; calling EGS-Library
-
- move.l a0,map(a7) ; save parameter
- move.w d0,x(a7)
- move.w d1,y(a7)
- move.w d2,w(a7)
- move.w d3,h(a7)
- move.w d4,ox(a7)
- move.w d5,oy(a7)
-
- moveq #0,d6
- moveq #0,d7
- move.w d1,d6 ; loop counter
- add.w d1,d3
- sub.w #1,d3 ; y + h - 1
- move.w d3,d7 ; end of loop
- 4$:
- ;
- ; compute the colorflow
- ;
-
- moveq #0,d0
- move.l d6,d0
- asl.l #8,d0
-
- ;
- ; put the parameter in register for RectangleFill
- ;
- move.l map(a7),a0
- move.w x(a7),d1
- move.l d6,d2 ; loop counter
- move.w w(a7),d3
- moveq #1,d4 ; 1 pixel high
- moveq #0,d5
-
- LINKLIB _LVOEB_RectangleFill,my_egsblit(a5)
-
- addq #1,d6
-
- cmp.w d7,d6
- ble.b 4$ ; loop
- ; because the high is 1
- ; pixel
-
- lea my_MEM(a7),a7 ; give memory back
- movem.l (sp)+,d2-d7/a2-a7
- rts
-
- ScreenMode1: dc.b 'NEXT 1120x832',0
- ScreenMode: dc.l 0
- myptr: dc.l 0
- hoehe: dc.l 0
-
- mywin: dc.w 100
- dc.w 100
- dc.w 100
- dc.w 1
- dc.w 0
- dc.w 0
- dc.w 0
- dc.w 0
- dc.l 0
- dc.l EI_WINDOWCLOSE!EI_WINDOWBACK!EI_WINDOWDRAG
- dc.l 0
- dc.l name
- dc.l 0
- dc.l EI_iCLOSEWINDOW
- dc.l 0
- color:
- dc.l 0 ;1
- dc.l 0 ;2
- dc.l 0 ;3
- dc.l 0 ;4
- dc.l 0 ;5
- dc.l 0 ;6
- dc.l 0 ;8
- dc.l 0 ;Menu
- dc.l 0 ; Render
- dc.l 0 ; Render
- hook:
- dc.l myapply
- dc.l 0
-
- name: dc.b 'hook',0
- egsName: dc.b 'egs.library',0
- egsblitName: dc.b 'egsblit.library',0
- LibsName: dc.b 'EGS libs',0
- egslayerName: dc.b 'egslayers.library',0
- egsintuiName: dc.b 'egsintui.library',0
- nolibmsg: dc.b 'Can not open library "%s"',10,0
- Msg1: dc.b 'Open library "%s"',10,0
- Msg2: dc.b 'Call EI_OpenWindw',10,0
- Msg4: dc.b 'Cant Open Window',10,0
- Msg5: dc.b 'Call EI_CloseWindow',10,0
-
- cnop 4,0
-
- END
-
-
- <
-